To get a computer name in C#, use the property MachineName from the Environment Class:
C#
strComputerName = Environment.MachineName.ToString();
The Environment class is inherited from the System.Object. It provides information about the current platform and environment of the executable application.
Note: The Environment class can’t be inherited.
Related Articles
Comments
Thank you for this, Looking forward for your next tutorials. Thanks again !